﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;
using ClassLibrary.Entity;
using System.IO;

public partial class Admin_Information : System.Web.UI.Page
{
    TblInformationDAO inforDAO = new TblInformationDAO(Global.CONNECTION_STRING);

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        bool flag = false;
        try
        {
            TblInformation infor = new TblInformation();
           // infor.TextHeader = Server.HtmlDecode(Editor1.Content);
          //  infor.TextFooter = Server.HtmlDecode(Editor2.Content);

            string path = Server.MapPath("~\\Admin\\img\\Logo\\");
            string filename = FileUpload1.FileName;

            // lblMessage.Text = path;
            if (File.Exists(path + "\\" + filename))
            {
                lbMessage.Text = "Image Exist.Please chose image other !";
                return;
            }
            FileUpload1.SaveAs(path + "\\" + filename);
            infor.ImageURLLogo = filename;


            inforDAO.InsUpdInformation(infor, 1);
            flag = true;
        }
        catch (Exception ex)
        {
            throw ex;

        }

        if (flag)
        {
            Response.Redirect("~/Information.aspx");
        }
    }
}
